//
//  TYMBBLeManager.h
//  TY_MotorRemoteControl
//
//  Created by 徐伟新 on 2023/11/16.
//  Copyright © 2023 zhongdaodianzi. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "CalculateTool.h"
#import <CoreBluetooth/CoreBluetooth.h>

typedef void(^sendCommandBlock)(BOOL result, NSString * _Nullable resultStr);

NS_ASSUME_NONNULL_BEGIN

@interface TYMBBLeManager : NSObject
+ (instancetype)shareInstance;
@property (nonatomic, strong) CBCentralManager *centerManager;
@property (nonatomic, strong) CBPeripheral *peripheral;
@property (nonatomic, strong) NSMutableArray *peripheralArray;
@property (nonatomic, strong) CBCharacteristic *characteristic;

@property (nonatomic, strong) NSMutableArray *sendDataArray;
@property (nonatomic, strong) NSMutableArray *receiveDataArray;
/// 是否手动断开的
@property (nonatomic, assign) BOOL isHandControl;
/// 判断扫描状态
@property (nonatomic, assign) BOOL isScaning;
/// 扫描蓝牙
- (void)startScanAction;
/// 停止扫描
- (void)stopScanAction;
/// 连接蓝牙
- (void)connectBleWith:(CBPeripheral *)peripheral;
/// 断开蓝牙连接
- (void)disConnectedBleWith:(CBPeripheral *)peripheral;
/// 发送命令
- (void)sendDataWithCommand:(NSString *)command withBlock:(sendCommandBlock)block;
@end

NS_ASSUME_NONNULL_END
